package com.viking.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/add")
    public String add(){
        String result = restTemplate.getForObject("http://stock-service:8021/stock/reduce", String.class);
        System.out.println("下单成功！");
        return "ok,下单成功！库存服务调用返回："+result;
    }
}
